import axios from 'axios'

const requerstInstace = axios.create({
    baseURL:'/'
})

requerstInstace.interceptors.request.use(
    (config: any) => config,
    (error: any)=> Promise.reject(error)
)

requerstInstace.interceptors.response.use(
    (response: { status: number; data: any; })=>{
        if(response?.status === 200){
            return response?.data;
        }else{
            return {
                code:'-1',
                msg:'未知错误',
                data:null
            }
        }
    },
    (error: any) => Promise.reject(error)
)

export default requerstInstace